home *** CD-ROM | disk | FTP | other *** search
/ World of Education / World of Education.iso / world_t / tipsamp1.zip / TIPS-058.ASC < prev    next >
Text File  |  1992-08-23  |  2KB  |  47 lines

  1. TIP #:     058
  2. KEYWORDS:  Network, DESQview, Concurrent Access
  3. UPDATED:   August, 1992
  4.  
  5.  
  6. PROBLEM:   How can two network or DESQview users be prevented from accessing a
  7.            non-network application at the same time?
  8.  
  9. SYMPTOMS:  When two users are allowed to access the same program, files can
  10.            get corrupted.  Also, some of the programs may not be network
  11.            aware, and should not be shared among many simultaneous users.
  12.  
  13. SOLUTION:  The solution to this problem is to set up a batch file for each
  14.            application, using token files to prevent simultaneous access.  A
  15.            sample batch file would look like this:
  16.  
  17.                 :START
  18.  
  19.                 IF EXIST PROGRAM.TOK GOTO BUSY
  20.                 REM > PROGRAM.TOK
  21.                 PROGRAM
  22.                 ERASE PROGRAM.TOK
  23.                 GOTO EXIT
  24.  
  25.                 :BUSY
  26.                 ECHO Sorry, this program is in use.  Try again later.
  27.                 PAUSE
  28.  
  29.                 :EXIT
  30.  
  31.            This batch file checks for the existence of the file "PROGRAM.TOK".
  32.            If this file exists, it means that another user is currently using
  33.            the program.  The batch file then displays a message that the
  34.            program is in use and then exits.  If the program is not currently
  35.            in use, the batch file creates the file "PROGRAM.TOK" so that other
  36.            users will not have access.  It then runs your program, erasing the
  37.            token file when it exits.  If your program runs from its own batch
  38.            file, you should substitute the line "CALL PROGRAM" for "PROGRAM"
  39.            in the above example.  Note that you must leave off the .BAT
  40.            extension when you call another batch file.  You should substitute
  41.            your file names for "PROGRAM" in the above example.  By using token
  42.            files, programs which were never intended to be used on a network
  43.            can be safely accessed.  This technique can also be used from
  44.            withing DESQview to prevent multiple access to programs.  I use
  45.            token files to prevent simultaneous access to single-user doors on
  46.            my BBS, which runs under DESQview.
  47.